<template>
    <view>
        <navBar :title="title"></navBar>
        <view class="Search">
            <view class="iconfont icon-btn_search size40"></view>
            <input type="text" class="lookServer" v-model="name" placeholder="找服务" placeholder-class="place" @confirm="confirm" />
        </view>

        <List :pageData="pageData"></List>
    </view>
</template>

<script>
    import List from '@/zunyi/components/List.vue';
    export default {
        components: {
            List
        },
        data() {
            return {
                title: '找服务',
                name: '',
                pageData: []
            };
        },
        methods: {
            confirm() {
                if (!this.name) return;
                this.sortClassGoods();
            },
            sortClassGoods() {
                this.$http
                    .get({
                        url: '/singleSaleApi/sortClassGoods',
                        data: {
                            name: this.name,
                            classify_cate: 5
                        }
                    })
                    .then((res) => {
                        if (res.code != 100) return this.$Toast(res.msg);
                        const result = res.data.DataArr || [];
                        this.pageData = result;
                    });
            }
        }
    };
</script>

<style lang="scss" scoped>
    .Search {
        width: 690rpx;
        height: 80rpx;
        background-color: #f7f7f7;
        border-radius: 40rpx;
        margin: 20rpx auto;
        padding: 0 20rpx;
        display: flex;
        align-items: center;
        overflow: hidden;
        color: #c7c7c7;

        .lookServer {
            flex: 1;
            height: 100%;
            font-size: 26rpx;
            padding-left: 20rpx;
            display: flex;
            align-items: center;
            color: #333;
        }
        .place {
            color: #c7c7c7;
        }
    }
</style>
